var minSize = 5;
var maxSize = 50;
var newOn = 80;
var flake = $("<div></div>").css({ "position": "absolute", "top": "155px" }).html("＊");
$(function () {


    var documentHeight = $(window).height() -50;
    var documentWidth = $(window).width()-490;
    setInterval(function () {
        var startPositionLeft = Math.random() * documentWidth+250;
        var sizeFlake = minSize + Math.random() * maxSize;
        var endPositionLeft = Math.random() * documentWidth;
        var durationFall = documentHeight * 10 + Math.random() * 3000;
        var startOpacity = 0.7 + 0.3 * Math.random();
        var endOpacity = 0.5 * Math.random();
        flake.clone().appendTo($("body")).css({
            "left": startPositionLeft,
            "opacity": startOpacity,
            "font-size": sizeFlake,
            "color": "#88D2FC"
        }).animate({
            "top": documentHeight - 40,
            "left": endPositionLeft,
            "opacity": endOpacity
        }, durationFall, function () {
            $(this).remove();
        });
    }, newOn);
});